<template>
  <view
    @click.stop="clickBtnHandler"
    :class="{actionBtn: true, actionBtn0: position == 0, actionBtn1: position == 1, actionBtn2: position == 2, actionBtn3: position == 3 }"
    v-if="$orderModuleShowActionBtn(position, isUsedInMore)"
  >
    查看物流
  </view>
</template>

<script>
// 查看物流按钮
import { checkPosition, getOrderId } from "../utils/checkShowBtn.js"

export default {
  name: "chakanwuliu",
  
  props: {
    order: {
      type: Object,
      default: {},
    }, // 订单对象
    isUsedInList: {
      type: Boolean,
      default: true,
    }, // 是否使用在订单列表页面
    isUsedInMore: {
      type: Boolean,
      default: false,
    }, // 是否使用在省略号中
  },
  
  data() {
    return {}
  },

  computed: {
    position: function() {
      return checkPosition.chakanwuliu(this.order, this.isUsedInList)
    }
  },
  
  methods: {
    /**
     * 监听点击按钮
     */
    clickBtnHandler() {
      const orderId = getOrderId(this.order) // 订单ID
      this.$onTo(`/pages/logistics/logistics?orderId=${orderId}`) // 跳转到物流详情页面
    }
  }
}
</script>

<style>
</style>
